<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class test1 extends MY_Controller {

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     * 		http://example.com/index.php/skeleton
     *	- or -
     * 		http://example.com/index.php/skeleton/index
     *	- or -
     * Since this controller is set as the default controller in
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/skeleton/<method_name>
     * @see http://codeigniter.com/user_guide/general/urls.html
     */
    public function index()
    {
        $this->load->library('template');

        $this->template->set_title('Welcome');
        $this->template->add_js('modules/skeleton.js');
        $this->template->add_css('modules/skeleton.css');
    
        $this->load->helper('file');
        $test1_data = array();
        if ($test1_json = read_file(APPPATH . 'modules/test1/test1.json'))
        {
            $test1_data = json_decode($test1_json, TRUE);
        }
        if (empty($test1_data))
        {
            show_error('Failed to load test1.json');
        }

            
           
        $this->template->load_view('index', array(
            'pagelet_sidebar' => Modules::run('test1/_pagelet_sidebar', $test1_data),
            'test1_data' => $test1_data
        ));
    }

    public function _pagelet_sidebar($test1_data)
    {
        $this->load->view('pagelet_sidebar', array(
            'test1_data' => $test1_data,
        ));
    }
}

/* End of file skeleton.php */
/* Location: ./application/modules/skeleton/controllers/skeleton.php */